import Vue from 'vue'
import Router from 'vue-router'
import index from "./views/index.vue"
import movie from "./views/movie.vue"

Vue.use(Router)

export default new Router({
  routes: [
    {
      path:"/demo",
      name:"demo",
      component:()=>import("./views/Demo.vue"),
      meta:{
        keepAlive:true
      }
    },
    {
      path:"/",
      redirect:{name:"movie"}
    },
    {
      path:"/index",
      name:"index",
      component:index,
      children:[
        {
          path:"movie",
          name:"movie",
          component:movie,
          meta:{
            keepAlive:true
          }
        },{
          path:"cinema",
          name:"cinema",
          //动态路由加载
          component:()=>import("./views/cinema.vue"),
          meta:{
            keepAlive:true
          }
        },{
          path:"boxoffice",
          name:"boxoffice",
          component:()=>import("./views/boxoffice.vue"),
          meta:{
            keepAlive:true
          }
        },{
          path:"my",
          name:"my",
          component:()=>import("./views/my.vue"),
          meta:{
            keepAlive:true
          }
        }
      ]

    },
    {
      path:"/detail",
      name:"detail",
      component:()=>import("./views/detail.vue")
    },
    {
      path:"/saveCollection",
      name:"saveCollection",
      component:()=>import("./views/saveCollection.vue")
    }
  ]
})
